package ynu.edu.online_course.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Update;
import ynu.edu.online_course.entity.CourseType;

@Mapper
public interface CourseTypeMapper {

    @Insert("INSERT INTO course_type (id, type_name) VALUES (#{id}, #{type_name})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insertCourseType(CourseType courseType);

    @Update("UPDATE course_type SET type_name = #{type_name} WHERE id = #{id} ")
    int updateCourseType(CourseType courseType);
}
